计算机与现代化 ›› 2012, Vol. 1 ›› Issue (1): 122-125.doi: 10.3969/j.issn.1006-2475.2012.01.032

• 网络与通信 • 上一篇    下一篇

表述性状态转移网络服务平台的研究及实施

江 南   

  1. 湖北工业大学计算机学院,湖北 武汉 430068
  • 收稿日期:2011-08-15 修回日期:1900-01-01 出版日期:2012-01-10 发布日期:2012-01-10

Research and Implementation of RESTful Web Services

JIANG Nan   

  1. School of Computer Science, Hubei University of Technology, Wuhan 430068, China
  • Received:2011-08-15 Revised:1900-01-01 Online:2012-01-10 Published:2012-01-10

摘要: 电子商务的蓬勃发展使得越来越多的采购商们倾向于利用互联网络进行采购。然而,尽管大部分商业网站都提供了详细周全的产品查询功能,但是当采购商们需要查询大量产品,譬如电子产品元器件,来进行采购时,往往费时费力。而网页这种适宜人类用户进行查询浏览的界面形式并不适合程序来自动处理,一个原因就是网页结构的变化会影响网页数据的抽取过程。本文利用网络服务的思想,使数据抽取通过网站提供的独立于网页的服务来完成,从而避免网页结构变化的影响。在剖析了表述性状态转移面向资源以及对资源进行操作的统一接口特性后,本文指出表述性状态转移用于网络服务的优势。基于这种思想,利用CXF框架和Spring技术构建一个表述性状态转移风格的服务平台,该平台向客户提供查询电子产品信息的网络服务。在此服务支持下,客户端程序可以利用XML解析工具方便地抽取所需要的数据信息。

关键词: 数据抽取, 网络服务, 表述性状态转移, 面向资源, 统一接口

Abstract: The development of E-commerce encourages more and more buyers to purchase products via the Internet. Although most of business websites provide comprehensive query functions to help buyers find out what they want, unfortunately, when it comes to huge quantities of queries of different products, this kind of human query in front of a screen becomes time-consuming and tedious. And it is not easy for programs to extract Web data from Web pages. One reason is that the structure of Web pages may change. This paper uses the thinking of Web service to solve this problem. Web data extraction is done through a kind of Web service, independent of Web pages, provided by the website. This paper analyzes the way of thinking behind REST (Representational State Transfer) and illuminates the central abstraction concept of resource and the feature of emphasizing the uniform interface, which distinguishes REST architecture style from other network-based architecture styles. It points that RESTful Web service is a better solution to build Web services, compared with SOAP-style Web service. Constructing a RESTful Web service which provides electronic product query service based on Apache CXF framework in the context of Spring technology, and based on this service, a data extraction client can obtain Web data conveniently using XML parser tools.

Key words: data extraction, Web service, REST, resource-oriented, uniform interface

中图分类号: